package com.example.dayu521.sg_oss.service.feign;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.example.dayu521.OrRes;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient("pay")
public interface PayServiceRpc {

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    final class CloseOrderParam{
        private String order_no;
        private Boolean force_close;
        private String close_reason="";
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    final class CloseOrderRes {
        private String close_reason = "";
        private String order_state;
    }
    @PostMapping("/close_order")
    OrRes<CloseOrderRes> close_order(@RequestBody CloseOrderParam closeOrderParam);

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    final class TradeStateParam{
        private String  order_no;
    }
    @PostMapping("/poll_trade_state")
    OrRes<String> poll_trade_state(@RequestBody TradeStateParam tradeStateParam);

    @PostMapping("/clean_up_unreached_order")
    OrRes<?> clean_up_unreached_order(@RequestBody String order_no);
}
